package cn.shentianlan.controller;

import cn.shentianlan.criteria.ClassroomSchedulingCriteria;
import cn.shentianlan.domain.dto.ClassroomSchedulingDTO;
import cn.shentianlan.domain.entity.ClassroomScheduling;
import cn.shentianlan.service.ClassroomSchedulingService;
import cn.shentianlan.utils.Result;
import org.apache.ibatis.annotations.Results;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author 陈俊源
 * @Description 课室时间安排
 * @Date 2021/5/6
 * @Version 1.0
 */
@RestController
@RequestMapping("/classroomScheduling")
public class ClassroomSchedulingController {

    @Autowired
    private ClassroomSchedulingService classroomSchedulingService;

    @PostMapping("/list")
    public Result findClassroomSchedulingByCriteria(@RequestBody ClassroomSchedulingCriteria criteria){
        Result result = classroomSchedulingService.findClassroomSchedulingByCriteria(criteria);
        return result;
    }

    @PostMapping("/saveOrUpdate")
    public Result saveOrUpdateClassroomScheduling(@RequestBody ClassroomSchedulingDTO classroomSchedulingDTO){
        Result result = classroomSchedulingService.saveOrUpdate(classroomSchedulingDTO);
        return result;
    }

    @RequestMapping("/getClassroomScheduling")
    public Result getClassrooomSchedulingById(Long id){
        Result result = classroomSchedulingService.getClassrooomSchedulingById(id);
        return result;
    }

    @PostMapping("/deleteClassroomScheduling")
    public Result deleteClassroomSchedulingById(Long id){
        Result result = classroomSchedulingService.deleteCLassroomSchedulingById(id);
        return result;
    }
}
